/**
 * 
 */
package ikeuilib;

import java.awt.BorderLayout;
import java.awt.Frame;
import java.util.Date;

import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.GridLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;



/**
 * @author ikechan
 *
 */
public class CalendarDialog extends JDialog {
	
	private DateTimePicker DtPicker = new DateTimePicker();
	private Date dtold;
	
	public CalendarDialog(Frame frame){
		//super(frame);
		getContentPane().setLayout(new BorderLayout());
		getContentPane().add(DtPicker,BorderLayout.CENTER);
		
		JPanel panel = new JPanel();
		getContentPane().add(panel, BorderLayout.SOUTH);
		panel.setLayout(new GridLayout(1, 0, 0, 0));
		
		JButton btnCancel = new JButton("Cancel");
		btnCancel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				//DtPicker.setDate(dtold);
				setVisible(false);
			}
		});
		panel.add(btnCancel);
		
		JButton btnOK = new JButton("OK");
		btnOK.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				dtold = DtPicker.getDate();
				setVisible(false);
			}
		});
		panel.add(btnOK);
		setSize(205,216);
		setModal(true);
	}

	/**
	 * @param dd
	 */
	public  void setDate(Date dd) {
		dtold = dd;
	}

	/**
	 * @return
	 */
	public  Date getDate() {
		return dtold;
	}
	
}
